import 'package:wanxiang_app/generated/json/base/json_convert_content.dart';
import 'package:wanxiang_app/bean/hot_game_entity.dart';

HotGameEntity $HotGameEntityFromJson(Map<String, dynamic> json) {
  final HotGameEntity hotGameEntity = HotGameEntity();
  final int? code = jsonConvert.convert<int>(json['code']);
  if (code != null) {
    hotGameEntity.code = code;
  }
  final String? msg = jsonConvert.convert<String>(json['msg']);
  if (msg != null) {
    hotGameEntity.msg = msg;
  }
  final List<HotGameData>? data = (json['data'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<HotGameData>(e) as HotGameData).toList();
  if (data != null) {
    hotGameEntity.data = data;
  }
  return hotGameEntity;
}

Map<String, dynamic> $HotGameEntityToJson(HotGameEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['code'] = entity.code;
  data['msg'] = entity.msg;
  data['data'] = entity.data.map((v) => v.toJson()).toList();
  return data;
}

extension HotGameEntityExtension on HotGameEntity {
  HotGameEntity copyWith({
    int? code,
    String? msg,
    List<HotGameData>? data,
  }) {
    return HotGameEntity()
      ..code = code ?? this.code
      ..msg = msg ?? this.msg
      ..data = data ?? this.data;
  }
}

HotGameData $HotGameDataFromJson(Map<String, dynamic> json) {
  final HotGameData hotGameData = HotGameData();
  final String? id = jsonConvert.convert<String>(json['id']);
  if (id != null) {
    hotGameData.id = id;
  }
  final String? backimg = jsonConvert.convert<String>(json['backimg']);
  if (backimg != null) {
    hotGameData.backimg = backimg;
  }
  final String? type = jsonConvert.convert<String>(json['type']);
  if (type != null) {
    hotGameData.type = type;
  }
  final String? name = jsonConvert.convert<String>(json['name']);
  if (name != null) {
    hotGameData.name = name;
  }
  final String? code = jsonConvert.convert<String>(json['code']);
  if (code != null) {
    hotGameData.code = code;
  }
  return hotGameData;
}

Map<String, dynamic> $HotGameDataToJson(HotGameData entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['backimg'] = entity.backimg;
  data['type'] = entity.type;
  data['name'] = entity.name;
  data['code'] = entity.code;
  return data;
}

extension HotGameDataExtension on HotGameData {
  HotGameData copyWith({
    String? id,
    String? backimg,
    String? type,
    String? name,
    String? code,
  }) {
    return HotGameData()
      ..id = id ?? this.id
      ..backimg = backimg ?? this.backimg
      ..type = type ?? this.type
      ..name = name ?? this.name
      ..code = code ?? this.code;
  }
}